package com.stone.framework.task.entity;

import javax.persistence.Column;
import javax.persistence.Entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.stone.framework.core.entity.CommonEntity;
import com.stone.framework.core.util.Strings;

@TableName("ST_SCHEDULE_CONFIG")
@Entity(name = "ST_SCHEDULE_CONFIG")
public class ScheduleConfig extends CommonEntity {

    private static final long serialVersionUID = -3606016303837143263L;

    @TableField("SERVICE_NAME")
    @Column(name = "SERVICE_NAME")
    private String serviceName;

    @TableField("JOB_NAME")
    @Column(name = "JOB_NAME")
    private String jobName;

    @TableField("PARAMS")
    @Column(name = "PARAMS")
    private String params;

    @TableField("CRON")
    @Column(name = "CRON")
    private String cron;

    @TableField("REMARK")
    @Column(name = "REMARK")
    private String remark;

    @TableField("STATE")
    @Column(name = "STATE")
    private State state;

    public static enum State {
        DISABLED, ENABLED;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getJobName() {
        return jobName;
    }

    public void setJobName(String jobName) {
        this.jobName = jobName;
    }

    public String getParams() {
        return params;
    }

    public void setParams(String params) {
        this.params = params;
    }

    public String getCron() {
        return cron;
    }

    public void setCron(String cron) {
        this.cron = cron;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getState() {
        return state == null ? null : state.name();
    }

    public void setState(String state) {
        this.state = Strings.isEmpty(state) ? null : State.valueOf(state);
    }

}
